<template>
	<!-- 大布局 -->
	<view class="layout">
		
		<view class="navbar">
			<!-- 状态栏占位 -->
			<view class="status-bar" :style="{height:getStatusBarHeight() + 'px'}"></view>
			<view class="title-bar" :style="{ height: getTitleBarHeight() + 'px', marginLeft:getLeftIcon()+'px' }">
				<view class="title"> {{title}} </view>
				<view class="search">
					<uni-icons class="icon" type="search" color="#888" size=20></uni-icons>
					<text class="text"> search </text>
				</view>
			</view>
		</view>
		
		<view class="fill" :style="{height: getNavBarHeight() + 'px'}">
			
		</view>
		
	</view>
</template>

<script setup>
import { ref } from 'vue';
import { getStatusBarHeight, getTitleBarHeight, getNavBarHeight, getLeftIcon } from '@/utils/system.js';


defineProps({
	title:{
		type: String,
		default:"默认标题"
	}
})

</script>

<style lang="scss" scoped>
	.layout{
		.navbar{
			position: fixed;
			top: 0;
			left: 0;
			width: 100%;
			z-index: 10;
			background:
				// linear-gradient(to bottom,rgba(0,0,0,0), #fff 100%), 
				linear-gradient(to bottom, transparent 0%, #fff 400rpx), 
				// linear-gradient(to right, red, green);
				linear-gradient(to right, #beecd8 20%, #f4e2d8 );
			
			.status-bar{
				border: 2px solid reds;
			}
			.title-bar{
				display: flex;
				align-items: center;
				padding: 0 30rpx;
				height: 100rpx;
				
				border: 1px solid red;
				.title{
					font-size: 22px;
					font-weight: 700;
					color: $text-font-color-1;
				}
				.search{
					width: 220rpx;
					height: 50rpx;
					border-radius: 60rpx;
					background: rgba(255,255,255,0.4);
					border: 1px solid #fff;
					margin-left: 30rpx;
					color: #888;
					font-size: 30rpx;
					display: flex;
					align-items: center;
					.icon{
						margin-left: 5rpx;
					}
					.text{
						padding-left: 10rpx;
					}
				}
				
			}
		}
	}
</style>